package com.googlecode.nls4j.benchmarks.en;

import java.util.Locale;

import com.googlecode.nls4j.BundleStorage;
import com.googlecode.nls4j.CurrentBundle;
import com.googlecode.nls4j.EnumBundleLoader;
import com.googlecode.nls4j.NlsContext;
import com.googlecode.nls4j.NlsKey;

public enum Msg implements NlsKey<String> {
    M1("M1 default value"),
    M2("M2 default value"),
    M3("M3 default value");

    private static final CurrentBundle<Msg, String> currentBundle = CurrentBundle
            .newInstance(
                NlsContext.getDefault(),
                new BundleStorage<Msg, String>(Msg.class, EnumBundleLoader
                        .<Msg, String> getDefault(false)), true);

    private final String defaultValue;

    private Msg(final String defaultValue) {
        this.defaultValue = defaultValue;
    }

    public static CurrentBundle<Msg, String> getCurrentBundle() {
        return currentBundle;
    }

    @Override
    public String getName() {
        return name();
    }

    @Override
    public String getDefaultValue(final Locale locale) {
        return defaultValue;
    }

    @Override
    public String toString() {
        return currentBundle.getBundle().get(this);
    }
}
